﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DataMappers;
using ExaminationTT.Model;


namespace ConcreteMappersAndObjects.DomainObjects
{
    public class Student : DomainObject<int, Student>, IStudent
    {
        private int _number;
        private string _name;
        private IEnumerable<Subscription> _subscriptions;


        public Student() : base()
        { 
            
        }

        public Student(int ID, string name, int number, IEnumerable<Subscription> subscriptions) : base(ID)
        {
            _name = name;
            _number = number;
            _subscriptions = subscriptions;
        }


        protected override Student Self()
        {
            //TO CHECK if needed
            return this;
        }

        #region IStudent Members

        public int Number
        {
            get { return _number; }
            set { MarkDirty(); _number = value; }
        }

        public string Name
        {
            get { return _name; }
            set { MarkDirty(); _name = value; }
        }

        public IEnumerable<Subscription> Subscriptions
        {
            get { return _subscriptions; }
            private set
            {
                //TO CHECK BETTER
                MarkDirty();
                _subscriptions = value;
            }
        }

        #endregion

        #region IStudent Members

        int IStudent.Number
        {
            get { return _number; }
        }

        string IStudent.Name
        {
            get { return _name; }
        }

        IEnumerable<ISubscription> IStudent.Subscriptions
        {
            get { return _subscriptions.ToArray(); }
        }

        #endregion
    }
}
